<!DOCTYPE html>
<html><head>
    <link rel="shortcut icon" type="image/ico" href="http://192.168.1.197:8080/racommon/assets/favicon.ico">

    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="Cache-Control" content="no-cache">

    <link rel="stylesheet" type="text/css" href="nGeniusONE_files/jquery-ui.css">
    <link rel="stylesheet" type="text/css" href="nGeniusONE_files/ns-login.css">

    <style>
        .bannerStyle{
            position:absolute;
            background-color:#FF0000;
            width: 100%;
            margin: 0 auto;
            float: left;
            text-align:center;
            color:#fff;
            font-family: Helvetica, Arial, sans-serif;
            height:25px;
        }

        .bannerLable{
            height:25px;
            position:relative;
            top: 3px;
        }

        .ngImg{
            width: 264px;
            height: 37px;
        }

        .ngImg_dc{
            height: 75px;
            width: 535px;
        }

        .dfImg {
            width: 600px;   /* 345px; */
            height: 60px;   /* 40px;  */
        }
    </style>
    <script type="text/javascript" src="nGeniusONE_files/jquery-3.js"></script>
    <script src="nGeniusONE_files/jquery-ui.js"></script>

    <script src="nGeniusONE_files/nsLoginStrings.js" charset="UTF-8" type="text/javascript"></script>
    <script src="nGeniusONE_files/XerrorStrings.js" charset="UTF-8" type="text/javascript"></script>
    <script type="text/javascript" src="nGeniusONE_files/jquery.js"></script>
    <script type="text/javascript" src="nGeniusONE_files/aes.js"></script>
    <script src="nGeniusONE_files/jquery_002.js"></script>
    <!-- <script src="jquery.noty.js" type="text/javascript"></script> -->


    <script type="text/javascript">
        var netscout = {};
        netscout.nslogin = {};

        $(document).ready(function(){
            //String localization
            $("#usernameText").attr("placeholder", nsLogin.userName).val("").focus().blur();
            $("#passwordText").attr("placeholder", nsLogin.password).val("").focus().blur();
            $("#df-usernameText").attr("placeholder", nsLogin.userName).val("").focus().blur();
            $("#df-passwordText").attr("placeholder", nsLogin.password).val("").focus().blur();
            $("#copyrightLabel").text(nsLogin.copyright1 + "NETSCOUT" + nsLogin.copyright2);

            $("#ng1Text").text(nsLogin.ng1);
            $("#umcText").text(nsLogin.umc);
            $("#submitBtn").val(nsLogin.login);

            $("#usernameTextCP").attr("placeholder", nsLogin.userName).val("").focus().blur();
            $("#currentPasswordTextCP").attr("placeholder", nsLogin.currentpassword).val("").focus().blur();
            $("#passwordTextCP").attr("placeholder", nsLogin.newpassword).val("").focus().blur();
            $("#confirmPasswordTextCP").attr("placeholder", nsLogin.confirmpassword ).val("").focus().blur();
            $("#submitBtnCP").val(nsLogin.changePassword);

            //get the Xerror localized string or default to the description
            //if the string isn't in the bundle yet
            var errorDesc = "Unknown Error";
            var errorTextSel = "#errorText";
            var showCP = false;
            

            var passExpDays = -1;
            if (typeof XerrorStrings.xerr_16017 !== "undefined") {
                $(errorTextSel).text(XerrorStrings.xerr_16017);

            } else if( passExpDays > 0 && errorDesc.indexOf(20010) > -1) {
                $('#hContainer').hide();
                $('#df-hContainer').hide();
                $('#hContainerCP').show();
                $('#usernameTextCP').val("null");

            } else
                $(errorTextSel).text("Unknown Error");

            //verify browser support
            var browser = browserSupported();
            if (!browser.supported){
                $("#ng1Text").css("color", "#A0A0A0");
                $("#browserError").css("display", "block");
                $(".bowserVer").text(browser.name + " " + nsLogin.vers + " " + browser.version + " " + nsLogin.notSupported);
            }

            if(window.parent.location.href.indexOf("SecureBanner.jsp") != -1){
                $(".bannerStyle").hide();//logout condition
                window.parent.location.href = window.location.href;
            }
            else{//show warning if configured
                var doConfirm = "false";
                if (doConfirm.toLowerCase() === "true"){
                    netscout.nslogin.createConfirm();
                    netscout.nslogin.$cnfDlg.dialog('open');

                    //If dialog is open then listen for enter key as acknowledge
                    $(document).keyup(function(e) {
                        if(e.which == 13) {
                            netscout.nslogin.$cnfDlg.dialog('close');
                        }
                    });
                }
            }

            
        });//end ready


        netscout.nslogin = {
            $cnfDlg:Object,  //object for the confirmation dialog
            $passwdDlg:Object,  //object for the confirmation dialog

            desktopChoice: function(evt){
                //set the hidden input if the radio has changed
                $("#nsRedirectField").val(evt.value);
            },

            createConfirm:function(){
                var dlglogoutButton = {};
                dlglogoutButton["同意"] = function() {
                    $(this).dialog("close");
                    return true;
                };

                this.$cnfDlg = $('<div id="cnfDlgDiv" style="text-align: left"></div>').html("使用这个计算机系统建造一个全时间段监控的规则。")
                    .dialog({
                        autoOpen: false,
                        width: "350",
                        title: "NETSCOUT 安全消息",
                        modal: true,
                        buttons: dlglogoutButton,
                        closeOnEscape: false
                    });
            },

            showNotificationDialog:function () {
                var dlglogoutButton = {};
                dlglogoutButton["OK"] = function() {
                    $(this).dialog("close");
                    window.location.href = '\x2Fconsole';
                    return true;
                };

                this.$passwdDlg = $('<div id="cnfDlgDiv" style="text-align: left"></div>').html("请更换密码。 你的密码将在 -1 day(s)天后过期。")
                    .dialog({
                        autoOpen: false,
                        width: "350",
                        title: "NETSCOUT 安全消息",
                        modal: true,
                        buttons: dlglogoutButton,
                        closeOnEscape: false
                    });
            },

            showPassChangeDialog:function () {
                var dlglogoutButton = {};
                dlglogoutButton["OK"] = function() {
                    $(this).dialog("close");
                    return true;
                };

                this.$passwdChngDlg = $('<div id="cnfDlgDiv" style="text-align: left"></div>').html("密码更换成功，请用新密码登录。 ")
                    .dialog({
                        autoOpen: false,
                        width: "350",
                        title: "NETSCOUT 安全消息",
                        modal: true,
                        buttons: dlglogoutButton,
                        closeOnEscape: false

                    });
            },

            encrypt:function(){
                var displayPassword= document.loginform.displayPassword.value;
                var theKey = "7B355CBDA832F79610543A5D4B7BA231";
                var aesEncryptionEnabled = "true";

                if (aesEncryptionEnabled.trim() === "false") {
                    var stheKey = theKey.substring(0,8);
                    document.loginform.password.value = $.rc4EncryptStr(displayPassword, stheKey );
                }
                else {
                    var stheKey = theKey.substring(0,16);
                    var stheKey32 = stheKey + stheKey;
                    var key = CryptoJS.enc.Utf8.parse(stheKey32);
                    var iv= CryptoJS.enc.Utf8.parse('ulFAiLTrKotxpnPV');

                    var encrypted = CryptoJS.AES.encrypt(displayPassword, key, { iv: iv });
                    var cipherText = encrypted.ciphertext.toString();
                    document.loginform.password.value = cipherText;
                }

                var username = document.loginform.displayUsername.value;
                var un =  encodeURIComponent(username);
                document.loginform.username.value = un;
                document.loginform.displayPassword.value = document.loginform.password.value;
            },

            encryptChangePassword:function(){
                var displayCurrUser= document.changePassform.displayCurrUsername.value;
                var displayCurrPassword= document.changePassform.displayCurrPass.value;
                var displayNewPassword= document.changePassform.displayNewPass.value;
                var displayConfPassword= document.changePassform.displayConfPass.value;

                var continueFlag = true;
                var value = $('#currentPasswordTextCP').val();
                var element = $('#errorTextCP');
                $(element).text("");

                //OLD PASSWORD VALIDATION
                //if(continueFlag) if ()
                if(continueFlag) continueFlag = nowhitespace(value,element);

                //CURRENT PASSWORD VALIDATION
                value = $('#passwordTextCP').val();
                if(continueFlag) continueFlag = nowhitespace(value,element);
                if(continueFlag) continueFlag = minLength(value, element);
                if(continueFlag) continueFlag = maxLength(value, element);
                if(continueFlag) continueFlag = alphanumeric2(value, element);
                if(continueFlag) continueFlag = specialChars(value, element);
                if(continueFlag) continueFlag = repeatChars(value, element);
                if(continueFlag) continueFlag = casesensitive(value, element);
                if(continueFlag) continueFlag = consecutiveChars(value, element);

                //CONFIRM PASSWORD VALIDATION
                value = $('#confirmPasswordTextCP').val();
                if(continueFlag) continueFlag = nowhitespace(value,element);
                if(continueFlag) continueFlag = equalTo($('#passwordTextCP').val(), value, element);

                if(continueFlag) {
                    //alert("continueFlag "+continueFlag);
                    var theKey = "7B355CBDA832F79610543A5D4B7BA231";
                    var aesEncryptionEnabled = "true";

                    if (aesEncryptionEnabled.trim() === "false") {
                        var stheKey = theKey.substring(0,8);
                        document.changePassform.currentPassword.value = $.rc4EncryptStr(displayCurrPassword, stheKey );
                        document.changePassform.newPassword.value = $.rc4EncryptStr(displayNewPassword, stheKey );
                        document.changePassform.confirmPassword.value = $.rc4EncryptStr(displayConfPassword, stheKey );
                    }
                    else {
                        var stheKey = theKey.substring(0,16);
                        var stheKey32 = stheKey + stheKey;
                        var key = CryptoJS.enc.Utf8.parse(stheKey32);
                        var iv= CryptoJS.enc.Utf8.parse('ulFAiLTrKotxpnPV');

                        // displayCurrPassword
                        var encrypted = CryptoJS.AES.encrypt(displayCurrPassword, key, { iv: iv });
                        var cipherText = encrypted.ciphertext.toString();
                        document.changePassform.currentPassword.value = cipherText;

                        // displayNewPassword
                        encrypted = CryptoJS.AES.encrypt(displayNewPassword, key, { iv: iv });
                        cipherText = encrypted.ciphertext.toString();
                        document.changePassform.newPassword.value = cipherText;

                        // displayConfPassword
                        encrypted = CryptoJS.AES.encrypt(displayConfPassword, key, { iv: iv });
                        cipherText = encrypted.ciphertext.toString();
                        document.changePassform.confirmPassword.value = cipherText;
                    }

                    document.changePassform.currentUsername.value = displayCurrUser;
                } else {
                    return false;
                }
            }
        };

        function nowhitespace(value, element) {
            if(/^\S+$/i.test(value)) {
                return true;
            }
            element.text("Field cannot contain white space");
            return false;
        }

        function alphanumeric2(value, element) {
            

            return true;
        }

        function checkAlphaNumeric(value) {
            if (/(^\d+$)/.test(value)) {
                return false;
            }
            if (/^[a-zA-Z]+$/.test(value)) {
                return false;
            }
            /*checkMinNumber(value);
            checkMinLowerCase(value);*/
            return true;
        }

        function checkMinNumber(value, requiredNumbers) {
            return value.replace(/[^0-9]/g, "").length >= requiredNumbers; //value.replace(/\D/g, '').length
        }

        function checkMinLowerCase(value, minRequired) {
            var count = value.length - value.replace(/[a-z]/g, '').length;
            return count >= minRequired;
        }

        function checkMinUpperCase(value, minRequired) {
            var numUpper = value.length - value.replace(/[A-Z]/g, '').length;
            return numUpper >= minRequired;
        }

        function specialChars(value, element) {
            var specialChars= false;
            var specialCharExpected = -1;
            var displayMsg = "Must contain at least "+ specialCharExpected + ' special character(s)';

            if(specialCharExpected > 0) {
                var specialCharCount = value.length - value.replace(/[^0-9a-zA-Z\s]/g, '').length;
                if(specialCharCount >= specialCharExpected) {
                    return true;
                } else {
                    $(element).text(displayMsg);
                    return false;
                }
            }
            //$(element).text("Must contain at least one [:,.#$@%^&*()+<>?;|!]_ special character");
            return true;
        }

        function casesensitive(value, element) {
            var caseSensitive=  false;
            if(caseSensitive && !(/[a-z]/.test(value) && /[A-Z]/.test(value))){
                $(element).text("Must enter at least one uppercase and lowercase letter");//"one_uppercase_one_lowercase");
                return false
            }
            return true;
        }

        function consecutiveChars(value, element) {
            var consecutiveCount = -1;
            var isConsq = true;
            if(consecutiveCount > 0){
                //isConsecutiveNumbers(value);
                isConsq = !isConsecutiveChars(value, consecutiveCount);
                if(isConsq) {
                    $(element).text("Cannot contain more than "+consecutiveCount+" consecutive character(s)");
                }
            }
            return isConsq;
        }

        function isConsecutiveChars(value, maxAllowedCount ) {
            //console.log(".....isConsecutiveChars ..........."+value);
            var valArr = [];

            var matchFound1 = false;
            var continueLoop = true;
            for (var i = 0; i <= value.length; i++) {
                valArr = [];
                for(var j = i, count=0; count < maxAllowedCount; j++, count++) {
                    valArr[count] =  value.charCodeAt(j);
                }

                //console.log("valArr : "+$.toJSON(valArr));
                if((valArr.length) >= maxAllowedCount ) {
                    for(var k = 0; k < valArr.length-1; k++) {
                        if((valArr[k+1] - valArr[k]) !== 1) {
                            //if(Math.abs(valArr[k] - valArr[k+1]) !== 1) {
                            continueLoop = false;
                            break;
                        }

                        if(k == valArr.length-2) {
                            matchFound1 = true;
                            break;
                        }
                    }
                    if(matchFound1) {
                        break;
                    }
                }
            }
            /*if (!matchFound1) { console.log("Invalid - not consecutive");}
             else console.log("valid - consecutive  ");*/
            return matchFound1;
        }

        function repeatChars (value, element) {
            var repeatCharCount = -1;
            if(repeatCharCount > 0){
                var rex = new RegExp("(.)\\1{"+repeatCharCount+",}");
            }
            var isNotRepeat = !(/(.)\1{3,}/.test(value));
            if(!isNotRepeat) $(element).text("Cannot contain more than "+repeatCharCount+" repeat character(s)");
            return isNotRepeat
        }

        function minLength(value, element) {
            var miniLength = -1;
            if(miniLength == undefined || miniLength == null || parseInt(miniLength) < 8) {
                miniLength = 8;
            } else {
                miniLength = parseInt(miniLength);
            }

            if(value.length < miniLength) {
                $(element).text("Please enter minimum "+miniLength+ " characters");
                return false;
            }
            return true;
        }

        function maxLength(value, element) {
            var maxLength = -1;
            if(maxLength == null || maxLength == null || maxLength == -1 || maxLength > 255) {
                maxLength = 255;
            }
            if(value.length > maxLength) {
                $(element).text("Please enter less than "+maxLength+" characters" );
                return false;
            }
            return true;
        }

        function equalTo(newPassword, confirmPassword, element) {
            if(newPassword != null && confirmPassword != null && newPassword === confirmPassword) {
                return true;
            } else {
                element.text("Confirm Password mismatch");
                return false;
            }
        }

        function browserSupported(){
        var browser = {
            name: nsLogin.unknown,
            version: "0",
            supported: false
        };

        var supported = {
            chrome: 47,
            mozilla: 43,
            safari: 8,
            msie: 11,
                };

        var sUsrAg = navigator.userAgent;
        if(sUsrAg.indexOf("Chrome") > -1) {
            browser.name = nsLogin.chrome;
            var raw = sUsrAg.match(/Chrom(e|ium)\/([0-9]+)\./);
            var chrVer = parseInt(raw[2], 10) ;
            browser.version = chrVer;

            if(chrVer >= supported.chrome){
               browser.supported = true;
            }
        } else if (sUsrAg.indexOf("Safari") > -1) {
            browser.name = nsLogin.safari;
            var raw = sUsrAg.match(/Version\/([0-9]+)\./);
            var sfVer = parseInt(raw[1], 10);
            browser.version = sfVer;

            if(sfVer >= supported.safari){
               browser.supported = true;
            }
        }
        else if (sUsrAg.indexOf("Firefox") > -1) {
            browser.name = nsLogin.mozilla;
            var match = sUsrAg.match(/Firefox\/([0-9]+)\./);
            browser.version = match ? parseInt(match[1]) : 0;

            if(browser.version >= supported.mozilla){
                browser.supported = true;
            }

        }else if (sUsrAg.indexOf("Trident") > -1) {
            browser.name = nsLogin.msie;
            var triVersion = /\brv[ :]+(\d+)/g.exec(sUsrAg);

            if(triVersion !== null){
                browser.version = triVersion[1];
                if(browser.version >= supported.msie){
                    browser.supported = true;
                }
            }
            else{
              var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
              if (re.exec(sUsrAg) != null)
                 browser.version = parseFloat( RegExp.$1 );
            }
        };
        return browser;
    }
    </script>
    <title>nGeniusONE</title>

</head>
<body onload="loginform.displayUsername.focus();" style="position:relative" class="ng1-body">
<div id="row1" class="bannerStyle" style="display:none; top:0px;">
    <label class="bannerLable">CLASSIFIED</label>
</div>

<div id="vContainer"></div>
<div id="hContainer">
    <div class="ng1-logo">
            <img src="nGeniusONE_files/nGeniusONE-logo.svg" class="ngImg">
        </div>
    <div id="formTable">
        <form action="NSLogin.jsp" method="post" name="loginform" autocomplete="off">
            <input type="hidden" name="mode" value="login">
            <input type="hidden" id="nsRedirectField" name="redirect" value="/console">
            <input type="hidden" name="username">
            <input type="hidden" name="password">

            <div class="form-username">
                <input id="usernameText" class="form-control" type="text" name="displayUsername" maxlength="100" placeholder="用户名">
            </div>

            <div class="form-password">
                <input id="passwordText" class="form-control" type="password" name="displayPassword" maxlength="100" placeholder="密码">
            </div>
            <br>
            <hr>
            <a>Register</a> <a>Forget Password</a>
            <div class="form-submit">
                <input id="submitBtn" class="submBtn" type="submit" value="登入" onclick="return netscout.nslogin.encrypt();">
            </div>

            <table boder="0" cellpadding="6px">
                <tbody><tr id="browserError" style="display:none">
                    <td colspan="2" class="bowserVer" style="color: #fff;font-size: 12pt;"></td>
                </tr>
            </tbody></table>
        </form>
    </div>
</div>
<div id="hContainerCP" style="display: none;">
    <div class="ng1-logo">
        <img src="nGeniusONE_files/nGeniusONE-logo.svg" class="ngImg">
    </div>

    <div id="formTableCP" style="">
        <form action="NSLogin.jsp" method="post" name="changePassform" autocomplete="off">
            <input type="hidden" name="mode" value="changePassword">
            <input type="hidden" id="nsRedirectFieldCP" name="redirect" value="/console">
            <input type="hidden" id="currentTokenId" name="currentTokenId">
            <input type="hidden" name="currentUsername">
            <input type="hidden" name="currentPassword">
            <input type="hidden" name="newPassword">
            <input type="hidden" name="confirmPassword">

            <div class="form-username">
                <input id="usernameTextCP" class="form-control" type="text" name="displayCurrUsername" maxlength="100" disabled="disabled" placeholder="用户名">
            </div>

            <div class="form-password">
                <input id="currentPasswordTextCP" class="form-control nowhitespace" type="password" name="displayCurrPass" maxlength="100" placeholder="当前密码">
            </div>

            <div class="form-password">
                <input id="passwordTextCP" class="form-control alphanumeric2 specialchars casesensitive consecutiveChar repeatChars minlength nowhitespace" type="password" name="displayNewPass" maxlength="100" placeholder="新密码">
            </div>

            <div class="form-password">
                <input id="confirmPasswordTextCP" class="form-control nowhitespace" type="password" name="displayConfPass" maxlength="100" placeholder="确认密码">
            </div>

            <div class="form-submit">
                <input id="submitBtnCP" class="submBtn" type="submit" value="更换密码" onclick="return netscout.nslogin.encryptChangePassword();">
            </div>
            <table boder="0" style="color: #fff;font-size: 10pt;" cellpadding="6px">
                <tbody><tr id="browserError" style="display:none;">
                    <td colspan="2" class="bowserVer" style="color: #fff;font-size: 12pt;"></td>
                </tr>
            </tbody></table>
        </form>
    </div>
</div>
<div class="login-copyright">
    <label id="copyrightLabel">©2020 NETSCOUT 保留所有权利。</label>
    </div>
<div id="row3" class="bannerStyle" style="display:none; bottom:0px;">
    <label class="bannerLable">CLASSIFIED</label>
</div>


</body></html>